package com.artist.starter.service.impl;

import com.artist.starter.domain.entity.SysUser;
import com.artist.starter.mapper1.SysUserMapper;
import com.artist.starter.service.SysUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SysUserServiceImpl implements SysUserService {

    @Autowired
    private SysUserMapper mapper;
    @Override
    public SysUser login(String username) {
        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
        Map<String, String> map = new HashMap<>();
        map.put("user_name",username);
        queryWrapper.allEq(map);
        List<SysUser> sysUsers = mapper.selectList(queryWrapper);
        SysUser sysUser = sysUsers.get(0);
        return sysUser;
    }

    @Override
    public SysUser logout() {
        return null;
    }
}
